package org.bigdata.framework.core.protocol;

import java.util.HashMap;
import java.util.List;

import org.bigdata.framework.core.model.AnalysisTopic;
import org.bigdata.framework.core.model.AppCircles;
import org.bigdata.framework.core.model.AppCirclesComment;
import org.bigdata.framework.core.model.AppCirclesDianzan;
import org.bigdata.framework.core.service.IAppCirclesCommentService;
import org.bigdata.framework.core.service.IAppCirclesDianzanService;
import org.bigdata.framework.core.service.IAppCirclesService;
import org.bigdata.framework.core.utils.MybatisPlusTools;
import org.springframework.beans.factory.annotation.Autowired;

import com.baomidou.mybatisplus.plugins.Page;

public class AppService implements IAppService {
	
	@Autowired
	private IAppCirclesDianzanService appCirclesDianzanService;
	@Autowired
	private IAppCirclesCommentService appCirclesCommentService;
	@Autowired
	private IAppCirclesService appCirclesService;
	@Override
	public AppCircles saveAppCircles(AppCircles appCircles) {
		boolean r = appCirclesService.insert(appCircles);
		if (r) {
			return appCircles;
		}
		return null;
	}
	@Override
	public AppCircles editAppCircles(AppCircles appCircles) {
		boolean r = appCirclesService.updateAllColumnById(appCircles);
		if (r) {
			return appCircles;
		}
		return null;
	}
	@Override
	public void deleteAppCircles(AppCircles appCircles) {
		boolean r = appCirclesService.deleteById(appCircles.getId());
		if (r) {
			System.out.println("appCircles 删除成功>>>" + appCircles.getId());
		}
		
	}
	@Override
	public AppCircles findAppCircles(Integer id) {
		return appCirclesService.selectById(id);
	}
	@Override
	public List<AppCircles> getAppCircles() {
		return appCirclesService.selectList(null);
	}
	@Override
	public List<AppCircles> getAppCircles(HashMap<String, Object> queryParams, int pageNumber, int pageSize) {
		return appCirclesService.selectPage(
				new Page<AppCircles>(pageNumber, pageSize),
				new MybatisPlusTools<AppCircles>().getEwByList(queryParams))
				.getRecords();
	}
	@Override
	public Integer getAppCirclesCount(HashMap<String, Object> queryParams) {
		return appCirclesService.selectCount(new MybatisPlusTools<AppCircles>()
				.getEwByCount(queryParams));
	}
	@Override
	public AppCirclesComment saveAppCirclesComment(AppCirclesComment appCirclesComment) {
		boolean r = appCirclesCommentService.insert(appCirclesComment);
		if (r) {
			return appCirclesComment;
		}
		return null;
	}
	@Override
	public AppCirclesComment editAppCirclesComment(AppCirclesComment appCirclesComment) {
		boolean r = appCirclesCommentService.updateAllColumnById(appCirclesComment);
		if (r) {
			return appCirclesComment;
		}
		return null;
	}
	@Override
	public void deleteAppCirclesComment(AppCirclesComment appCirclesComment) {
		boolean r = appCirclesCommentService.deleteById(appCirclesComment.getId());
		if (r) {
			System.out.println("appCirclesComment 删除成功>>>" + appCirclesComment.getId());
		}
	}
	@Override
	public AppCirclesComment findAppCirclesComment(Integer id) {
		return appCirclesCommentService.selectById(id);
	}
	@Override
	public List<AppCirclesComment> getAppCirclesComment() {
		return appCirclesCommentService.selectList(null);
	}
	@Override
	public List<AppCirclesComment> getAppCirclesComment(HashMap<String, Object> queryParams, int pageNumber,
			int pageSize) {
		return appCirclesCommentService.selectPage(
				new Page<AppCirclesComment>(pageNumber, pageSize),
				new MybatisPlusTools<AppCirclesComment>().getEwByList(queryParams))
				.getRecords();
	}
	@Override
	public Integer getAppCirclesCommentCount(HashMap<String, Object> queryParams) {
		return appCirclesCommentService.selectCount(new MybatisPlusTools<AppCirclesComment>()
				.getEwByCount(queryParams));
	}
	@Override
	public AppCirclesDianzan saveAppCirclesDianzan(AppCirclesDianzan appCirclesDianzan) {
		boolean r = appCirclesDianzanService.insert(appCirclesDianzan);
		if (r) {
			return appCirclesDianzan;
		}
		return null;
	}
	@Override
	public AppCirclesDianzan editAppCirclesDianzan(AppCirclesDianzan appCirclesDianzan) {
		boolean r = appCirclesDianzanService.updateAllColumnById(appCirclesDianzan);
		if (r) {
			return appCirclesDianzan;
		}
		return null;
	}
	@Override
	public void deleteAppCirclesDianzan(AppCirclesDianzan appCirclesDianzan) {
		boolean r = appCirclesDianzanService.deleteById(appCirclesDianzan.getId());
		if (r) {
			System.out.println("appCirclesDianzan 删除成功>>>" + appCirclesDianzan.getId());
		}
		
	}
	@Override
	public AppCirclesDianzan findAppCirclesDianzan(Integer id) {
		return appCirclesDianzanService.selectById(id);
	}
	@Override
	public List<AppCirclesDianzan> getAppCirclesDianzan() {
		return appCirclesDianzanService.selectList(null);
	}
	@Override
	public List<AppCirclesDianzan> getAppCirclesDianzan(HashMap<String, Object> queryParams, int pageNumber,
			int pageSize) {
		return appCirclesDianzanService.selectPage(
				new Page<AppCirclesDianzan>(pageNumber, pageSize),
				new MybatisPlusTools<AppCirclesDianzan>().getEwByList(queryParams))
				.getRecords();
	}
	@Override
	public Integer getAppCirclesDianzanCount(HashMap<String, Object> queryParams) {
		return appCirclesDianzanService.selectCount(new MybatisPlusTools<AppCirclesDianzan>()
				.getEwByCount(queryParams));
	}

	

}
